home *** CD-ROM | disk | FTP | other *** search
/ InterCD 1999 March / marchl_1999.iso / Site Building / Mallsurfer Shop / _SETUP.1 / invoice_js.txt < prev    next >
Encoding:
Text File  |  1998-12-03  |  2.3 KB  |  100 lines

  1.  
  2. <script language="JavaScript">
  3.  
  4. function ShowInvoice() 
  5. {
  6.     totprice = 0;
  7.     itemlist = 0;
  8.     TotQty = 0;
  9.     TotWeight = 0;
  10.     FinalTotWeight = 0;
  11.  
  12.  
  13.     document.writeln('<table border=2 cellspacing=5 cellpadding=5>');
  14. ###TITLE_ROW###
  15.  
  16.     for(NumItems = 0; NumItems<MaxCartItems; NumItems++)
  17.     {
  18.         CookieName = "Cart" +NumItems;
  19.         CookieValue = GetCookie(CookieName);
  20.  
  21.         if(CookieValue != null)
  22.         {
  23.             for(var i = 0;i <= CookieValue.length; i++)
  24.             {
  25.                 // using 0192,0193,0194,0195,0196
  26.                 if (CookieValue.substring(i,i+1) == '[') 
  27.                 {
  28.                     itemstart = i+1;
  29.                 } 
  30.                 else if (CookieValue.substring(i,i+1) == '└') 
  31.                 {
  32.                     ID = CookieValue.substring(itemstart, i);
  33.                     itemstart = i+1;
  34.                 } 
  35.                 else if (CookieValue.substring(i,i+1) == '┴') 
  36.                 {
  37.                     Sdesc = CookieValue.substring(itemstart, i);
  38.                     itemstart = i+1;
  39.                 }
  40.                 else if (CookieValue.substring(i,i+1) == '┬') 
  41.                 {
  42.                     Price = CookieValue.substring(itemstart, i);
  43.                     itemstart = i+1;
  44.                 }
  45.                 else if (CookieValue.substring(i,i+1) == '├') 
  46.                 {
  47.                     Qty = CookieValue.substring(itemstart, i);
  48.                     itemstart=i+1;
  49.                 } 
  50.                 else if (CookieValue.substring(i,i+1) == '─') 
  51.                 {
  52.                     Weight = CookieValue.substring(itemstart, i);
  53.                     itemstart = i+1;
  54.                 }
  55.                 else if (CookieValue.substring(i,i+1) == ']') 
  56.                 {
  57.                     WeightUnit = CookieValue.substring(itemstart, i);
  58.                     itemstart = i+1;
  59.  
  60.                     TotQty = TotQty + parseInt(Qty);
  61.                     TotWeight = Weight * Qty;
  62.  
  63.                     ItemTotal = 0;
  64.                     ItemTotal = (eval(Price*Qty));
  65.                     temptotal = ItemTotal * 100;
  66.                     totprice = totprice + ItemTotal;
  67.  
  68.                     FItemTotal = FloatFormat(ItemTotal,2);
  69.                     FTotWeight = FloatFormat(TotWeight,2);
  70.  
  71. ###CONVERT_UNIT###
  72. ###SHOW_ITEM###
  73.                 }
  74.             }
  75.         }
  76.     }
  77.  
  78.     Ftotprice = FloatFormat(totprice,2);
  79. ###SUB_TOTAL_ROW###
  80.  
  81. ###TAX###
  82.     FTax = FloatFormat(Tax,2);
  83.     FCTax = FloatFormat(CTax,2);
  84. ###SHIPPING###
  85.     FShipping = FloatFormat(Shipping,2);
  86.     FOCShipping = FloatFormat(OCShipping,2);
  87. ###SHIPPING_ROW###
  88.  
  89.     NatFGrandTotal = FloatFormat(totprice + CTax + Shipping,2);
  90.     ONatFGrandTotal = FloatFormat(totprice + Shipping + OCShipping,2);
  91.     FGrandTotal = FloatFormat(totprice + Tax + CTax + Shipping,2);
  92. ###TAX_ROW###
  93. ###NAT_TOTAL_ROW###
  94. ###TOTAL_ROW###
  95. ###OUT_COUNTRY_ROW###
  96.     document.writeln('</table>');
  97. }
  98.  
  99. </script>
  100.